#include "BigInteger.h"
#include <thread>
using namespace std;
#define sleep(X) std::this_thread::sleep_for(std::chrono::seconds(X));
int main(){
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    BigInteger a,b;
    cout << "测试即将开始，请稍后..." << endl;
    sleep(3);
    cout << "第一阶段开始测试：" << endl;
    cout << "请输入a，b两个数值，进行循环测试，自加测试：" << flush;
    cin >> a >> b; //cin流测试
    for (BigInteger i = a; i <= b; i++) { //循环测试，自加测试
        cout << i << endl; //cout流测试
    }
    cout << "第一阶段测试结束！" << endl;
    sleep(3);
    cout << "第二阶段开始测试：" << endl;
    cout << "当前a的数值：" << a << "，当前b的数值：" << b << endl;
    cout << "即将开始进行加法、减法、乘法、除法和取余测试：" << flush;
    sleep(1);
    cout << "a+b:" << a+b << endl; //加法测试
    sleep(1);
    cout << "a-b:" << a-b << endl; //减法测试
    sleep(1);
    cout << "a*b:" << a*b << endl; //乘法测试
    sleep(1);
    cout << "a/b:" << a/b << endl; //除法测试
    sleep(1);
    cout << "a%b:" << a%b << endl; //取余测试
    cout << "第二阶段测试结束！" << endl;
    sleep(3);
    cout << "第三阶段开始测试：" << endl;
    BigInteger n;
    cout << "请输入n,进行循环测试，自减测试：" << flush;
    cin >> n;
    for(BigInteger j = n; j >= BigInteger("-0300"); j--){ //循环测试，自减测试
        cout << "Hello World!" << endl;
    }
    cout << "第三阶段测试结束！" << endl;
    sleep(3);
    cout << "第四阶段开始测试：(本次测试会4次循环测试，测试取绝对值)" << endl;
    BigInteger c, d;
    for (BigInteger i = BigInteger("1"); i <= BigInteger("4"); i++) { //循环测试，自加测试
        cout << "请输入两个数：" << flush;
        cin >> c >> d; //cin流测试
        cout << "a的绝对值：" << c.abs() << "，b的绝对值：" << d.abs() << endl; //cout流测试
    }
    cout << "第四阶段测试结束！" << endl;
    sleep(3);
    cout << "第五阶段开始测试：(测试除0异常捕获测试)" << endl;
    sleep(1);
    try{
        BigInteger a("300"),b("0");
        BigInteger c = a/b;
    }
    catch(const std::invalid_argument& e){
        std::cerr << e.what() << '\n';
        cout << "异常捕获成功！" << flush;
    }
    cout << "第五阶段测试结束" << endl;
    sleep(3);
    cout << "第六阶段测试开始:(测试循环和使用整形传参构造测试)" << endl;
    for (BigInteger i = BigInteger(1); i <= BigInteger(10000); ++i)
    {
        cout << "Hello World!" << endl;
        cout << "i的数值：" << i << endl;
    }
    cout << "第六阶段测试结束" << endl;
    cout << "测试结束！" << endl;
    sleep(3);
    return 0;
}